import socket

server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

server.bind(('127.0.0.1', 8882))

server.listen(5)

conn, addr = server.accept()

info=conn.recv(1024).decode('utf-8')

while info != 'quit':
    if info != '':
        print('接受到数据是：', info)

    data = input('请输入要发送的数据：')

    conn.send(data.encode('utf-8'))

    if data == 'quit':
        break
    info = conn.recv(1024).decode('utf-8')

conn.close()
server.close()

